<template>
  <div class="app-container">
    <el-form inline>
      <!-- <el-form-item label="用户名称">
        <el-input v-model="query.arg1" clearable/></el-form-item>
      <el-form-item label="用户状态">
        <el-select v-model="query.arg2" clearable>
          <el-option label="在线" value="1" />
          <el-option label="下线" value="2" /></el-select>
      </el-form-item> -->
      <el-form-item>
        <el-button type="primary" icon="el-icon-search">查询</el-button>
        <el-button type="danger" icon="el-icon-plus">新增</el-button>
        <el-button type="warning" icon="el-icon-upload2">导出</el-button></el-form-item>
    </el-form>
    <page-table ref="table" index :fetch="getTableList" :query="queryParams">
      <el-table-column align="center" min-width="120" label="用户名" prop="col1"  show-overflow-tooltip/>
      <el-table-column align="center" min-width="180" label="用户创建时间" prop="col2"  show-overflow-tooltip/>
      <el-table-column align="center" min-width="180" label="IP地址" prop="col3"  show-overflow-tooltip/>
      <el-table-column align="center" min-width="180" label="所在区域" prop="col4" show-overflow-tooltip/>
      <el-table-column align="center" min-width="180" label="描述" prop="col5" show-overflow-tooltip/>
      <el-table-column align="center" min-width="180" label="操作" >
        <template slot-scope="{row}">
          <el-button type="text" @click="editObj(row)">编辑</el-button>
          <el-button type="text" @click="deleteObj(row)">删除</el-button></template>
      </el-table-column>
    </page-table>
  </div>
</template>

<script>
import { getExamplePageList } from '@/api/document'
export default {
  data () {
    return {
      queryParams: {}
    }
  },
  methods: {
    getTableList (query) {
      return getExamplePageList(query)
    },
    refreshTable () {
      this.$refs.table.refresh()
    },
    deleteObj (row) {
      this.$confirm(
        `是否删除【${row.col1}】,删除角色将同时关闭角色下的用户？`,
        '删除提示',
        { type: 'warning' }
      ).then(() => {
        this.$message({
          type: 'success',
          message: '删除成功!'
        })
        this.refreshTable()
      })
    },
    editObj (row) {
      console.log('编辑')
    }
  }
}
</script>

<style scoped lang="scss">

</style>
